< previous page page_412 next page >

Page 412
Even the simple Notepad application enables you to drag a text file from the Explorer window into an open Notepad window to display the contents of the file. OLE drag and drop was so useful that when Microsoft developed the initial design for Windows 95, it included OLE drag and drop as one of the main standards that defines a Windows 95-compliant product. These standards are used to determine if a new product meets the requirements to be able to display the Windows 95 Logo on its packaging and documentation.
This chapter includes a review of what drag and drop is, how it works, and how to use it. More importantly, you will learn how to incorporate the concepts of drag and drop into the Address Book application. You will see how to enable the user to drag a name from the TreeView control to an icon on the toolbar that will print the selected entries information or to display it in the data entry control (remember that you have converted the form into an ActiveX custom control).
Defining OLE Drag and Drop
OLE drag and drop is probably the most powerful, if not the most misunderstood, feature available to you when designing your Visual Basic application. By adding the capability to drag object information from one control to another, from a control to another Windows application, or from another application into yours, you are enhancing your application with whatever other applications the user has on his computer.
If you have been coding Visual Basic for any length of time, you should be very familiar with standard drag-and-drop capabilities that are supported by the controls within a Windows application. The concepts you learned to use drag-and-drop functionality are still useful when using the new OLE drag-and-drop features. The difference is that OLE drag and drop opens your Visual Basic application to other applications running on the user's PC.
Most of the controls included with Visual Basic support OLE drag and drop in some manner. Depending on which control you are using, OLE drag and drop can be used without adding any additional code, although you might need to write some code to support the function you require. Three levels of OLE drag and drop support exist; the controls included with Visual Basic all contain support at one of these levels:
Level 1Supports only manual OLE drag and drop. This requires you to write the code needed to support any drag-and-drop functionality.
Level 2Supports only automatic drag functions. If you need any drop functionality, you must code for it.
Level 3Provides full support for the automatic OLE drag-and-drop capabilities.

 
< previous page page_412 next page >

If you like this book, buy it!